﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Text;
using YAPL.Language.Core.Types;
using Ast = YAPL.Language.Ast;
using YAPL.Language.Compiler.CodeGen.ReflectionEmitGenerator.AstGen.Helpers;

namespace YAPL.Language.Compiler.CodeGen.ReflectionEmitGenerator.AstGen {
	public class ReConstantGenerator : ReExpressionGenerator {
		public ReConstantGenerator(ReCodeGenerator generator) : base(generator) { }
		public override void Generate(Ast.Expression expr) {
			var constant = (Ast.ConstantExpression)expr;

			var ilGen = Generator.Get<ILGenerator>(ReCodeGenerator.IL_GENERATOR_KEY);
			ilGen.EmitCreateSimpleType(constant.Type, constant.Value);

		}
	}
}
